// =======================================================================================================================
// *** CREATING YOUR OWN MODULES? ***
// If you create your own modules, you can register them in two ways (via TypeScript or JavaScript):
// 1. a) Custom application modules: 
//       Include a 'manifest.ts' file with your 'app.ts' file and simply create a "module DreamSpace.System.Modules.$_??? { }" block in the manifest with your own
//       registered modules; where "???" is your namespace (grouping) name. The namespace name must be unique (such as a domain name) for shared modules.  If using
//       a domain name as the namespace name, the popular '.com' domains can leave out the TLD name ('.com') as a shortcut.  If you don't have a domain, then at
//       least use an alias name, your own name, or some other unique name (as unique as possible).  This helps to prevent clashing of same named modules from
//       different developers.  See the modules below for formatting examples.  The root 'manifest.ts' application manifest file is loaded automatically by the
//       DreamSpace system after all requested modules complete loading.
//    b) 3rd-Party Modules:
//       Using module namespaces for grouping is required for 3rd-parties wishing to release their own modules.  As best practice, all 3rd-party modules
//       should be placed in a sub folder under the 3rd-party namespace name, along with a 'manifest.ts/js' file.  End users only have to reference this ONE
//       manifest file in their TS projects (and add the HTML references AFTER the "DreamSpace.js" reference), which simply contains your own "Modules" list.
// 2. In a JavaScript file ('.js', i.e. outside TypeScript), simply add your domain/alias namespace name to the "DreamSpace.Modules" object
//    (ex: "DreamSpace.Modules.$_MyDomain = {};"), then register the module's type name (such as
//    "DreamSpace.Modules.$_MyDomain.MyModuleName = DreamSpace.Modules.registerModule(...);").
//
// In all cases, you have two options to load a module:
// 1. By calling "DreamSpace.Modules.using(DreamSpace.Modules.$_Namespace.Module_Name)" (dynamic loading/load on demand).
// 2. Manually by adding an HTML "<script src='moduleFileName.js'></script>" tag (fixed, and always loaded).
//
// Note: Once a module is loaded (in either case), the type will become registered, so future calls to 'DreamSpace.System.Modules.using()' will be ignored
// (except any callbacks passed in will be called immediately).
//
// TIP: In TypeScript, place "import using = DreamSpace.System.Modules.using;" before your code for convenience if desired (or
// "var using = DreamSpace.System.Modules.using;" in JavaScript).
// =======================================================================================================================

declare var manifest: DreamSpace.Scripts.Plugin.$Type;

/** DreamSpace specific system related modules. */
module DreamSpace.Scripts.Modules.System {
    // -------------------------------------------------------------------------------------------------------------------
    // System Plugins 
    
    /** A special collection for indexing objects. */
    export var Collections_IndexedObjectCollection = module('.Collections.IndexedObjectCollection{min:.min}');

    /** A special collection that allows observing changes (such as add/remove operations). */
    export var Collections_ObservableCollection = module('.Collections.ObservableCollection{min:.min}');

    /** References all collections. */
    export var Collections = module('.Collections{min:.min}');

    /** The core DreamSpace system. */
    export var Core = module('.Core{min:.min}', null, null, Collections_IndexedObjectCollection);

    /** The core DreamSpace system. */
    export var Core_AppDomain = module('.Core.AppDomain{min:.min}', null, null, Core);

    /** The core DreamSpace system. */
    export var Events = module('.Events{min:.min}', null, null, Core);

    /** The core DreamSpace system. */
    export var IO_Path = module('.IO.Path{min:.min}', null, null, Core);

    /** Contains specialized classes and functions for dealing with mark-up type code (i.e. HTML, XML, etc.). */
    export var Markup = module('.Markup{min:.min}');

    /** This module contains classes for building DreamSpace applications using a 'Graph' element layout system.
    * Note: This is only the logical application layer, and does not contain any UI classes.  For UI based applications,
    * include System.UI and a UI implementation of your choice (such as System.UI.HTML or Twitter.Bootstrap).
    */
    export var Platform = module('.Platform{min:.min}', null, null, Collections, Markup);

    /** The main DreamSpace system core.  This module is already included by default, and is here only for consistency. */
    export var UI = module('.UI{min:.min}.js', null, null, Platform);

    /** The DreamSpace UI module contains HTML related objects for UI designed.
    * Note: As with most DreamSpace graph objects, the objects are "logical" elements, and thus, a visual layout environment is (eg. browser) is not required.
    */
    export var UI_HTML = module('.UI.HTML{min:.min}', null, null, UI); // ('.' will cause 'DreamSpace' to be prefixed automatically)

    /** This module contains types and functions for common communication tasks. */
    export var Net = module('.Net{min:.min}', null, null, Collections);

    /** DreamSpace Studio and Server contains a plugin system called 'ICE' (Interface Communications Engine).
    * ICE only works in desktop app or server mode, and as such, this module is only valid in those contexts.
    */
    export var ICE = module('.ICE{min:.min}', null, null, Platform);

    /** This module contains types and functions for common data manipulation tasks. */
    export var Data = module('.Data{min:.min}', null, null); // JSON stuff

    // -------------------------------------------------------------------------------------------------------------------

    include("manifest-plugins", true);
}
